import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 26727
 * Date: 2025-06-23
 * Time: 23:20
 */
public class Test1 {

    public static int[] twoSum(int[] num,int target) {
        // num[i],i
        Map<Integer,Integer> hash = new HashMap<>();

        for(int i = 0; i < num.length; i++) {
            int x = target-num[i];
            if(hash.containsKey(x)) {
                return new int[] {i,hash.get(x)};
            }
            hash.put(num[i],i);
        }

        return null;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] num = new int[n];
        for(int i = 0; i < n; i++) {
            num[i] = sc.nextInt();
        }
        int target = sc.nextInt();
        int[] ret = twoSum(num,target);
        System.out.println(Arrays.toString(ret));
    }
}
